package com.cyufeng.blog.repository;

import com.cyufeng.blog.entity.HotArticle;
import com.cyufeng.blog.entity.Images;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 热门文章
 *
 * @author Cyufeng
 * Data:2019.01.12
 */
@Repository
public interface  HotArticleRepository extends JpaRepository<HotArticle,Integer> {
    /**
     * 得到所有的热门文章
     * @return List<HotArticle>
     */
    @Query(value = "select * from hot_article t where t.DR ='0' and t.IS_ENABLE = '1' and t.IS_TOOL = '0'",nativeQuery = true)
    List<HotArticle> getAllArticle();

    /**
     * 得到所有的热门工具
     * @return List<HotArticle>
     */
    @Query(value = "select * from hot_article t where t.DR ='0' and t.IS_ENABLE = '1' and t.IS_TOOL = '1'",nativeQuery = true)
    List<HotArticle> getAllTool();
}
